package com.antis.olsl.magic.stave;

import android.text.TextUtils;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.antis.olsl.arouterlib.MagicRoutePath;
import com.antis.olsl.base.BaseActivity;
import com.antis.olsl.magic.databinding.ActivityStoreDetailBinding;
import com.antis.olsl.magic.response.StaveSummaryResp;

import timber.log.Timber;

/**
 * 五线谱-门店明细
 */
@Route(path = MagicRoutePath.ACTIVITY_STAVE_DETAIL)
public class StoreDetailActivity extends BaseActivity<ActivityStoreDetailBinding> {

    @Autowired
    StaveSummaryResp.ContentBean.ShopListBean listBean;
    @Autowired
    String startDate;

    @Override
    protected ActivityStoreDetailBinding getViewBinding() {
        return ActivityStoreDetailBinding.inflate(getLayoutInflater(), baseBinding.getRoot(), true);
    }

    @Override
    protected void initViews() {
        ARouter.getInstance().inject(this);
        Timber.tag("hhh").e("listBean= " + listBean);
        Timber.tag("hhh").e("startDate= " + startDate);
        if (null != listBean) {
            if (!TextUtils.isEmpty(listBean.shopName)) {
                viewBinding.textStoreName.setText(listBean.shopName);
            }
            String status;
            switch (listBean.status) {
                case 1:
                    status = "盈利";
                    break;
                case 2:
                    status = "亏损";
                    break;
                case 3:
                    status = "达成目标";
                    break;
                case 4:
                    status = "未达目标";
                    break;
                default:
                    status = "-";
                    break;
            }

            viewBinding.textStoreStatus.setText(status);

            if (!TextUtils.isEmpty(listBean.PoLSum)) {
                viewBinding.textProfitLoss.setText(listBean.PoLSum);
            }

            if (!TextUtils.isEmpty(listBean.realitySum)) {
                viewBinding.textActual.setText(listBean.realitySum);
            }

            if (!TextUtils.isEmpty(listBean.targetSum)) {
                viewBinding.textTarget.setText(listBean.targetSum);
            }

            if (!TextUtils.isEmpty(listBean.QoQSum)) {
                viewBinding.textMom.setText(listBean.QoQSum);
            }

            if (!TextUtils.isEmpty(listBean.YoYSum)) {
                viewBinding.textYoy.setText(listBean.YoYSum);
            }
        }

        if (!TextUtils.isEmpty(startDate)) {
            viewBinding.textDate.setText(startDate);
        }
    }

    @Override
    protected void initData() throws IllegalAccessException {

    }
}
